using EnvDTE;
using System;
using System.Runtime.Serialization;
using VSSDKAssist.Assets.References.Base;

namespace VSSDKAssist.Assets.References.VisualStudio
{
	/// <summary>
	/// UnboundReference for a solution
	/// </summary>
	[Serializable]
	public class SolutionReference : RecipeReferenceBase
	{
		#region Constructors
		/// <summary>
		/// Initializes a new instance of the <see cref="SolutionReference"/> class.
		/// </summary>
		/// <param name="recipe">The recipe.</param>
		public SolutionReference(String recipe) : base(recipe) {
		}
		#endregion

		#region Public Implementation
		/// <summary>
		/// Determines whether the reference is enabled for a particular target item,
		/// based on the condition contained in the reference.
		/// </summary>
		/// <param name="target">The <see cref="T:System.Object"/> to check for references.</param>
		/// <returns>
		/// 	<see langword="true"/> if the reference is enabled for the given <paramref name="target"/>.
		/// Otherwise, <see langword="false"/>.
		/// </returns>
		public override bool IsEnabledFor(object target)
		{
			return (target is Solution);
		}

		/// <summary>
		/// See <see cref="P:Microsoft.Practices.RecipeFramework.IAssetReference.AppliesTo"/>.
		/// </summary>
		/// <value></value>
		public override String AppliesTo
		{
			get { return Properties.Resources.VSSolutionRef; }
		} 
		#endregion

		#region ISerializable Members

		/// <summary>
		/// Required constructor for deserialization.
		/// </summary>
		protected SolutionReference(SerializationInfo info, StreamingContext context)
			: base(info, context)
		{
		}

		#endregion ISerializable Members
	}
}
